package com.techstar.ats.codec.live.decoder;

import io.netty.buffer.ByteBuf;
import com.techstar.ats.codec.Decoder;
import com.techstar.ats.codec.StringCodec;
import com.techstar.ats.dxp.live.F06RouteStatus;
import com.techstar.ats.dxp.live.F06SignalRoute;

public enum F06SignalRouteDecoder implements Decoder<F06SignalRoute> {
	INSTANCE;

	public F06SignalRoute create() {
		return new F06SignalRoute();
	}

	public void decode(ByteBuf buf, F06SignalRoute value) {
		value.signalName = (new StringCodec(20)).get(buf);
		int cnt = buf.readUnsignedByte();

		for(int i = 0; i < cnt; ++i) {
			F06RouteStatus status = F06RouteStatusDecoder.INSTANCE.create();
			F06RouteStatusDecoder.INSTANCE.decode(buf, status);
			value.status.add(status);
		}
	}
}
